package appapi.service.impl;

import appapi.Request.SelfItemReq;
import appapi.entity.basic.SelfcheckItemEntity;
import appapi.service.EquipTypeItemService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import appapi.entity.basic.EquipTypeItemEntity;
import appapi.dao.EquiptypeitemMapper;

import java.util.List;

/**
 * 请求对象
 *
 * @author luocheng
 * @version 1.0
 * @date 2023/05/30 12:57
 */
@Service
public class EquiptypeitemServiceImpl implements EquipTypeItemService {

    @Resource
    private EquiptypeitemMapper equiptypeitemMapper;
    @Override
    public List<EquipTypeItemEntity> list(Long equipTypeId){
        return equiptypeitemMapper.selectList(equipTypeId);
    }

    @Override
    public EquipTypeItemEntity detail(Long equipTypeItemId) {
        return equiptypeitemMapper.selectDetail(equipTypeItemId);
    }

    @Override
    public int count(EquipTypeItemEntity entity) {
        return equiptypeitemMapper.count(entity);
    }

    @Override
    public int insert(EquipTypeItemEntity entity) {
        return equiptypeitemMapper.insertInfo(entity);
    }

    @Override
    public int update(EquipTypeItemEntity entity) {
        return equiptypeitemMapper.updateInfo(entity);
    }

    @Override
    public int delete(Long equipTypeItemId) {
        EquipTypeItemEntity entity =equiptypeitemMapper.selectDetail(equipTypeItemId);
        if(entity==null)
        {
            return  -2;
        }
//        int iRet = equiptypeitemMapper.allowDelete(entity.getItemName());
//        if(iRet>0)
//        {
//            return  -1;
//        }
        return equiptypeitemMapper.deleteInfo(equipTypeItemId);
    }
}
